namespace GomuLibrary.IO.DiscImage
{
    using System;
    using System.Runtime.InteropServices;

    [StructLayout(LayoutKind.Sequential, Pack=1)]
    internal struct PathTableRecord
    {
        [MarshalAs(UnmanagedType.U1)]
        public byte Length;
        [MarshalAs(UnmanagedType.U1)]
        public byte ExtAttrRecLength;
        [MarshalAs(UnmanagedType.U4)]
        public uint ExtentLocation;
        [MarshalAs(UnmanagedType.U2)]
        public ushort ParentNumber;
        public static explicit operator PathTableRecordPub(PathTableRecord record) => 
            new PathTableRecordPub { 
                Number = record.Length,
                Extent = record.ExtAttrRecLength,
                ExtentLocation = record.ExtentLocation,
                ParentNumber = record.ParentNumber
            };
    }
}

